import axios from "axios";
import {get} from "lodash";

export function request(config, success, failure) {
  const instance = axios.create({
    headers: {
      'Authorization': localStorage.getItem("TOKEN"),
      'Content-Type': get(config, 'headers.Content-Type', 'application/json')
    },
    baseURL: 'http://localhost:8082/',
    timeout: 5000
  })

  instance(config)
    .then(res => {
      success(res);
    })
    .catch(err => {
      failure(err);
    })
}
